package com.lv.phuotbacnam.bl.storage;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Base storage component
 */
public class LocalStorage{

    private static final String STORAGE = "storage";

    /**Storage context*/
    private SharedPreferences sharedPreferences;

    public LocalStorage(Context context) {
        sharedPreferences = context.getSharedPreferences(STORAGE, Context.MODE_PRIVATE);
    }

    public String retrieveString(String key){
        return sharedPreferences.getString(key, null);
    }

    public void save(String key, String value){
        sharedPreferences.edit()
                .putString(key, value)
                .commit();
    }
}
